<!-- HBuilder X 版本要求: 3.6.11+ -->
<script lang="ts">
let firstBackTime = 0
export default {
  onLaunch: function () {
	  // 检查是否登录
	  let loginInfo = uni.getStorageSync('token')||null
	  if(loginInfo){
		  console.log(typeof(loginInfo) === 'string' ?'账号登录':'离线登录');
	  }else{
		  console.log('请先登录');
		 uni.reLaunch({
		 	url: '/pages/login/index'
		 });
	  }
    console.log('App Launch')
  },
  onShow: function () {


    console.log('App Show')
  },
  onHide: function () {
    console.log('App Hide')
  },
  onLastPageBackPress: function () {
    console.log('App LastPageBackPress')
    if (firstBackTime == 0) {
      uni.showToast({
        title: '再按一次退出应用',
        position: 'bottom',
      })
      firstBackTime = Date.now()
      setTimeout(() => {
        firstBackTime = 0
      }, 2000)
    } else if (Date.now() - firstBackTime < 2000) {
      firstBackTime = Date.now()
      uni.exit()
    }
  },
  onExit() {
    console.log('App Exit')
  },
}
</script>

<style>
/*每个页面公共css */
/* uni.css - 通用组件、模板样式库，可以当作一套ui库应用 */
/* #ifdef APP-VUE */
@import './common/uni.css';
/* #endif */

.uni-checkbox-input-checked,
	.uni-radio-input-checked,
	.uni-switch-input-checked {
		background-color:#5FB878 !important;
		border-color: #5FB878 !important;
		color: #fff !important;
    }
uni-data-checkbox:not([disabled]) .uni-checkbox-input:hover {
	 border-color: #5FB878;
}
</style>
